home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 13.1 KB | 375 lines | [TEXT/MPS ] |
- /*
- File: Power.idl
-
- Contains: Power Manager Interfaces.
-
- Version: Technology: System 7.5
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __POWER_IDL__
- #define __POWER_IDL__
-
- #include <somobj.idl>
- #include <somcls.idl>
-
- #ifndef __TYPES_IDL__
- #include <Types.idl>
- #endif
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
- #ifndef __MIXEDMODE_IDL__
- #include <MixedMode.idl>
- #endif
- #endif
- #if FOR_SYSTEM8_PREEMPTIVE
- #ifndef __KERNEL_IDL__
- #include <Kernel.idl>
- #endif
- #ifndef __NAMEREGISTRY_IDL__
- #include <NameRegistry.idl>
- #endif
- #endif
-
- #ifdef __SOMIDL__
-
- #if FOR_SYSTEM8_PREEMPTIVE
- /*
- ========================================================================================
-
- The top of this file contains the Power Management interfaces used in Copland.
-
- The pre-Copland interfaces are below right after a large and obnoxious comment.
-
- ========================================================================================
- */
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- Low level (I/O architecture) interface
-
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- */
- /*
- //------------------------------------------------------------------------------------
-
- Power Management usage monitoring.
-
- High level families call PMMonitorUsage for each hardware device they maintain.
- Power management will periodically send messages to the family requesting the
- current UsageCount for each device.
- If power management determines that a device is idle it may be taken off-line.
- Prior to doing so power managment will send a message instructing the family to
- prepare for the device being off-line. When the device is reqired again the family
- uses PMPrepareDevice to instruct power management to bring the device back on-line.
-
- //------------------------------------------------------------------------------------
- */
- typedef UInt32 PMUsageCount;
-
- typedef OpaquePtr PMMonitorRef;
-
- /*
- //------------------------------------------------------------------------------------
-
- Device Power State Management
-
- If a family maintains a device which is capable of switching between multiple
- power states, the family should inform power management of the device's
- capabilities and wait for messages directing it to change the device's power
- state.
-
- //------------------------------------------------------------------------------------
- */
- typedef OSType PMDeviceStateID;
-
- typedef UInt32 PMDeviceStateFlags;
-
- typedef SOMLargeStruct PMDeviceState; /* Derived from a struct of 12 bytes in size */
-
- typedef SOMLargeStruct PMDeviceDescriptionHdr; /* Derived from a struct of 8 bytes in size */
-
- typedef SOMLargeStruct PMDeviceDescription; /* Derived from a struct of 32 bytes in size */
-
- typedef OpaquePtr PMManageRef;
-
- /*
- //------------------------------------------------------------------------------------
-
- Power Management notification.
-
- Any entity in the I/O architecture can use these routines to be notified about
- changes to device.
-
- Clients use a mask to specify which device aspects they are interested in and
- also to specify when to be notified. Flags describing the new state are generated
- and delivered with the notification.
-
- If the client is interested in power being removed and re-applied, they can request
- it with (kPMNotifyAlwaysMask | kPMNotifyPowerMask). When the notification is
- delivered the client can check the new flags against kPMNotifyBeforeMask and
- kPMNotifyAfterMask to determine if the change has already occured or not. And can
- check against kPMDevicePoweredMask to determine if the device will have power or
- not in the new state.
-
- //------------------------------------------------------------------------------------
- */
- typedef UInt32 PMNotifyFlags;
-
- typedef OpaquePtr PMNotifyRef;
-
- /*
- //------------------------------------------------------------------------------------
-
- Power Management message
-
- This structure is used for all types of power management communication - usage
- monitoring, state change notification, and state change commands.
-
- //------------------------------------------------------------------------------------
- */
- typedef SOMLargeStruct PMMessageData; /* Derived from a struct of 8 bytes in size */
-
- typedef SOMLargeStruct PMMessage; /* Derived from a struct of 16 bytes in size */
-
- /*
- //------------------------------------------------------------------------------------
-
- Restoring an off-line or powered off device to a usable state.
-
- When a device that has been taken off-line or has had its power removed is needed
- again, the following routine should be called. This routine will return when after
- the device has been restored (or has failed to be restored). Part of the restoration
- process is delivering notifications to interested parties - kPMPowerRestore and/or
- kPMPrepareOnLine messages will be delivered and processed before this routine
- returns.
-
- //------------------------------------------------------------------------------------
- */
- /*
- //------------------------------------------------------------------------------------
-
- Disabling & Re-Enabling power managment of a device.
-
- Power management of a specific device can be disabled - this may be desirable
- because of a resource reservation on some device.
- Families can implement a family specific API on top of this that can allow
- an application to turn off power management for a particular volume or display
- device.
-
- When power management of some device is disabled usage monitoring will still
- occur, but there will not be any requests to change the device state. The
- domain of which the device is a member will not be changed either.
-
- //------------------------------------------------------------------------------------
- */
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- Domain Controller Power Management Plug-In interface.
-
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- */
- /*
- //------------------------------------------------------------------------------------
-
- Domain description
-
- //------------------------------------------------------------------------------------
- */
- typedef OSType PMDomainID;
-
- typedef OSType PMDomainLevelID;
-
- typedef UInt32 PMDomainLevelFlags;
-
- typedef SOMLargeStruct PMDomainLevel; /* Derived from a struct of 8 bytes in size */
-
- typedef SOMLargeStruct PMDomainDescriptionHdr; /* Derived from a struct of 12 bytes in size */
-
- typedef SOMLargeStruct PMDomainDescription; /* Derived from a struct of 28 bytes in size */
-
- /*
- //------------------------------------------------------------------------------------
-
- Domain plugin.
- Plugin init routine returns pointer to a domain description as an out parameter.
-
- //------------------------------------------------------------------------------------
- */
- typedef OpaquePtr PMDomainPluginInitProc;
- typedef OpaquePtr PMDomainPluginSetLevelProc;
- typedef SOMLargeStruct PMDomainPluginDispatchTable; /* Derived from a struct of 24 bytes in size */
-
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- Platform plugin.
-
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- */
- typedef OpaquePtr PMSleepProc;
- typedef OpaquePtr PMHibernateProc;
- typedef OpaquePtr PMShutdownProc;
- typedef OpaquePtr PMRestartProc;
- typedef SOMLargeStruct PMPlatformPlugin; /* Derived from a struct of 32 bytes in size */
-
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- High level (application) interface.
-
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- */
- /*
- Disk timer: the time a disk must be idle before it is spun down (or other
- power management actions are taken). Applies to all disks, but each disk
- has its own timer (one can stay spun up while the others are spun down).
-
- The minimum will be enforced.
-
- These API control system-wide parameters for the power management of disk devices.
- For control over a specific disk see the <Block Storage or File System> API.
-
-
- */
- /*
- Display timer: the period of time in which there has been no user input
- before a display is dimmed or turned off. Applies to all displays, but
- each display has its own timer.
-
- The minimum will be enforced.
- */
- /*
- Idle state timer: the period of time in which all devices must be idle
- before the system is [?]. Basically, this is the timer for whatever action
- the user chose to happen when the system is idle. Could be sleep, hibernate,
- or shutdown. If the user has explicitly disabled any action the routines
- return an error.
-
- The minimum will be enforced and will be greater than or equal to the
- maximum of disk spin down and display dimming times.
- */
- /*
- Idle state: routines to get and set the action to be taken when power
- management has determined that the system is idle.
- Disabled: nothing happens when the machine is idle
- Sleep is a soft definition - depends on the hardware: differs
- between portable and desktop systems.
- Hibernate: save everthing and shutdown, on boot reload the saved
- state.
- Shutdown: just shutdown, nothing restored on boot.
- */
- /*
- Misc. timers: These allow for programmable shutdown and power on. These are
- real absolute times - turn off at 6:00pm Jan 12 and back on at 8:00am Feb 1.
- The 'DateAndTimeSpec' is a made-up placeholder.
-
- Shutdown is a real shutdown.
- IdleAction puts the machine into the chosen idle state - if the machine is
- shutdown at the that time nothing happens.
- PowerOn is either a normal boot or a return-from-idle depending on whether
- the system is shutdown or is in its idle state.
- */
- /* Immediate control over system state*/
- /*
- //------------------------------------------------------------------------------------
-
- Other high level API.
-
- Other families may want to implement their own power management API that is built
- on top of the API presented here. Examples are the ability to turn off power
- management of a specific storage volume or a specific graphics display. The battery
- family will want/need to export a high level API that can show battery state.
-
- //------------------------------------------------------------------------------------
- */
- /*
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
- User activity monitoring.
-
- These routine are used by software that is interested in the lack of and resumption
- of user activity. The usage model is as follows: software requests to be notified
- when all user activity has ceased for a specified amount of time. Once that
- notification has been delivered any user activity will cause the second notification
- to be delivered immediately. After delivery of the resume notification, the reference
- is invalid and software must request notification again if it so desires.
-
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- */
- typedef OpaquePtr PMUserMonitorRef;
-
- #endif
- /*
- ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
-
-
- Everything below this comment is the System 7.x Power Manager
-
- This comment is really large and obnoxious so that the separation can be easily
- found when scrolling through the file.
-
-
- ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- */
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
- /* bits in bitfield returned by PMFeatures */
- /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
- /* bits in BatteryInfo.flags */
- /* ("chargerConnected" doesn't mean the charger is plugged in) */
- /* client notification bits in PMgrQueueElement.pmNotifyBits */
- /* System Activity Selectors */
- /* Storage Media sleep mode defines */
- typedef SOMLargeStruct ActivityInfo; /* Derived from a struct of 6 bytes in size */
-
- /* information returned by GetScaledBatteryInfo */
- typedef SOMFourByteStruct BatteryInfo; /* Derived from a struct of 4 bytes in size */
-
- typedef SInt8 ModemByte;
-
- typedef SInt8 BatteryByte;
-
- typedef long PMResultCode;
-
-
-
- typedef OpaquePtr SleepQRecPtr; /* Substituted OpaquePtr for “SleepQRec*” */
-
-
-
-
-
- typedef OpaquePtr SleepQProcPtr;
- typedef OpaquePtr SleepQUPP;
- typedef OpaquePtr HDSpindownProcPtr;
- typedef OpaquePtr HDSpindownUPP;
- typedef OpaquePtr PMgrStateChangeProcPtr;
- typedef OpaquePtr PMgrStateChangeUPP;
- typedef SOMLargeStruct SleepQRec; /* Derived from a struct of 12 bytes in size */
-
- typedef SOMLargeStruct HDQueueElement; /* Derived from a struct of 16 bytes in size */
-
- typedef SOMLargeStruct PMgrQueueElement; /* Derived from a struct of 20 bytes in size */
-
- typedef SOMLargeStruct BatteryTimeRec; /* Derived from a struct of 16 bytes in size */
-
- typedef SOMLargeStruct WakeupTime; /* Derived from a struct of 6 bytes in size */
-
- typedef SOMLargeStruct StartupTime; /* Derived from a struct of 6 bytes in size */
-
- /* Public Power Management API (NEW!) */
- #endif
-
- #endif /* __SOMIDL__ */
-
- #endif /* __POWER_IDL__ */
-
-